#/bin/sh
#usage DecompressFiles.sh <compress file dir> <destination dir>
if [ -d "$1" ]; then
    cd $1
    newest=`ls -t SGR.export*.zip| sed "s:^:$1/:"|head -1`
    if [ "$newest" == "" ]; then
        echo "No input file"
        exit 2
    fi
    if [ -d "$2" ]; then
        rm -rf $2
    fi
    unzip -d $2 $newest
else
    echo "The compressed file store directory can't be found"
    exit 1
fi

#TODO: verify files
